package fun.anin.aninhongbao.controller;

import fun.anin.aninhongbao.entity.User;
import fun.anin.aninhongbao.result.R;
import fun.anin.aninhongbao.service.UserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * (User)表控制层
 *
 * @author makejava
 * @since 2020-03-29 14:38:46
 */
@RestController
@RequestMapping("user")
public class UserController {
    /**
     * 服务对象
     */
    @Resource
    private UserService userService;

    @GetMapping("/list")
    public R list(){
        return R.ok(userService.list());
    }

    @PostMapping("/add")
    public R add(HttpServletRequest request,User entity){
        return userService.insert(request,entity);
    }
}